How can I get a List from LINQ to XML that produces List?

Don't create a new list for each item, just make one list: LegalTextIds = (from legalText in panel. Elements("LegalText"). Elements("Line") select (int)legalText.

Attribute("id")).ToList().

Use the SelectMany extension method: List> lists = new List>() { new List(){1, 2}, new List(){3, 4} }; var result = lists. SelectMany(x => x); // results in 1, 2, 3, 4 Or, for your specific case: var performancePanels = new { Panels = (from panel in doc. Elements("PerformancePanel") select new { LegalTextIds = (from legalText in panel.

Elements("LegalText"). Elements("Line") select new List() { (int)legalText. Attribute("id") }).

SelectMany(x => x) }).ToList() }.

How about this List GenListOfIntegers = (from panel in doc. Elements("PerformancePanel"). Elements("Line") select int.

Parse(panel. Attribute("id"). Value)).ToList().

Var result = lists. Panels = (from panel in doc. LegalTextIds = (from legalText in panel.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions